<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@ include file="/jsplib/pubhead.jsp"%>
<%@ page import="net.comm.friend.service.impl.FriendServiceImpl" %>
<%@ page import="net.comm.common.ReturnMessage" %>
<%@ page import="net.comm.friend.bean.BaseFriend" %>
<%@ page import="net.comm.tags.JstlFun" %>
<%@ page import="java.util.List" %>

<% 

		try {
			request.setCharacterEncoding("UTF-8"); 
			response.setCharacterEncoding("UTF-8"); 
		} catch (Exception e) {
			e.printStackTrace();
		}
		String userID = request.getParameter("userID");
		
		int ret = 0;
		StringBuffer sb = new StringBuffer(); 
		response.addHeader("Content-Type","text/html"); 

		if(!userID.equals("")){

			FriendServiceImpl service = new FriendServiceImpl();

			List list = service.list(Integer.valueOf(userID));
			if(list != null && list.size() > 0) 
			{		
				BaseFriend base = null;
				int len = list.size();

				for(int i=0; i<len; i++){

					base = (BaseFriend)list.get(i);

					sb.append("<option value=" + base.getFriendID() + " >"); 
					sb.append( JstlFun.GetUserNick(base.getFriendID()) + "</option>");
				}
				ret = 0;
			}else{
				//
				sb.append("<option >&nbsp;</option>");
				ret = 3;
			}
		}

		if(ret == 0)
		{

			//服务器返回给login.jsp的response
		}else if(ret == 1)
		{
           sb.append("获取数据库连接错误！");    
		   //服务器返回给login.jsp的response
		}else if(ret == 2)
		{
			sb.append("验证码不正确！");    
			//服务器返回给login.jsp的response
		}else if(ret == 3)
		{
			sb.append("" );    
			//服务器返回给login.jsp的response
		}
		response.getWriter().write(sb.toString()); 
		
 %>       
